﻿using AttributeRouting.Web.Http;
//using log4net;
using System;
using System.Web;
using System.Web.Security;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Data;
using System.Data.SqlClient;
using Water.Model;

namespace Water.RestService.Controllers
{
    public class MenuController : ApiController
    {

        private MenuTree mt;

        [GET("GetMenusForuser/{umenu}")]
        public IList<MenuTree> GetMenusForuser(string umenu)
        {
            mt = new MenuTree();
            return mt.GetMenutreeForUser(umenu);
        }


        [GET("GetAllMenus/{pageIndex}/{pageSize}")]
        public IList<MenuTree> GetAllMenus(int pageIndex, int pageSize)
        {
            mt = new MenuTree();
            return mt.GetAllMenuTrees(pageIndex, pageSize);
        }

        [POST("AddUserAndNodeid")]
        public bool PostAddUserAndNodeid(UserAndMenu uam)
        {
            UserAndMenu um = new UserAndMenu();
            return um.AddUserAndUser(uam) > 0 ? true : false;
        }
    }
}
